home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / disk / RCS / disk.h,v < prev    next >
Encoding:
Text File  |  1992-08-31  |  7.4 KB  |  272 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.4
  10. date     91.10.07.17.40.43;  author voelker;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     91.09.14.15.17.14;  author mendel;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     90.06.26.21.29.08;  author jhh;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     90.03.04.22.27.24;  author douglis;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @header file for disk library.
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @added declarations of LFS checkpoint header and area write routines
  38. @
  39. text
  40. @/*
  41.  * disk.h --
  42.  *
  43.  *    Definitions for utilities that examine an OFS filesystem through
  44.  *    a raw disk interface.
  45.  *
  46.  * Copyright 1990 Regents of the University of California
  47.  * Permission to use, copy, modify, and distribute this
  48.  * software and its documentation for any purpose and without
  49.  * fee is hereby granted, provided that the above copyright
  50.  * notice appear in all copies.  The University of California
  51.  * makes no representations about the suitability of this
  52.  * software for any purpose.  It is provided "as is" without
  53.  * express or implied warranty.
  54.  *
  55.  * $Header: /sprite/src/lib/c/disk/RCS/disk.h,v 1.3 91/09/14 15:17:14 mendel Exp Locker: voelker $ SPRITE (Berkeley)
  56.  */
  57.  
  58. #ifndef _DISK
  59. #define _DISK
  60.  
  61. #include <sys/file.h>
  62.  
  63. #include <kernel/fs.h>
  64. #include <kernel/dev.h>
  65. #include <kernel/fsdm.h>
  66. #include <kernel/ofs.h>
  67. #include <kernel/devDiskLabel.h>
  68.  
  69. /*
  70.  * include files for LFS structures and constants
  71.  */
  72. #include <kernel/lfsDesc.h>
  73. #include <kernel/lfsDescMap.h>
  74. #include <kernel/lfsFileLayout.h>
  75. #include <kernel/lfsSegLayout.h>
  76. #include <kernel/lfsStableMem.h>
  77. #include <kernel/lfsSuperBlock.h>
  78. #include <kernel/lfsUsageArray.h>
  79.  
  80. /*
  81.  * These should be here.  They should be in some machine dependent header
  82.  * file.  But for now ...
  83.  */
  84. #define BITS_PER_BYTE           8
  85. #define BITS_PER_INT            32
  86.  
  87. /*
  88.  * DISK_SECTORS_PER_BLOCK    Number of disk sectors per file system block.
  89.  * DISK_KBYTES_PER_BLOCK    Number of kbyte chunks per file system block.
  90.  */
  91. #define DISK_SECTORS_PER_BLOCK       (FS_BLOCK_SIZE / DEV_BYTES_PER_SECTOR)
  92. #define DISK_KBYTES_PER_BLOCK        (FS_BLOCK_SIZE / 1024)
  93.  
  94. /*
  95.  * Maximum number of partitions on a disk.
  96.  */
  97. #define DISK_MAX_PARTS 8
  98.  
  99. /*
  100.  * Maximum length of an ascii label inside a disk label.
  101.  */
  102. #define DISK_MAX_ASCII_LABEL 256
  103.  
  104. /*
  105.  * We understand two types of native disk labels: Sun labels and DEC labels.
  106.  */
  107.  
  108. typedef int Disk_NativeLabelType;
  109.  
  110. #define DISK_NO_LABEL  ((Disk_NativeLabelType) 0)
  111. #define DISK_SUN_LABEL ((Disk_NativeLabelType) 1)
  112. #define DISK_DEC_LABEL ((Disk_NativeLabelType) 2)
  113.  
  114. /*
  115.  * Information about a disk partition.
  116.  */
  117. typedef struct Disk_Partition {
  118.     int        firstCylinder;        /* First cylinder in partition. */
  119.     int        numCylinders;        /* Number of cylinders in partition.*/
  120. } Disk_Partition;
  121.  
  122. /*
  123.  * This is a canonical disk label.  The use of this structure allows
  124.  * programs to read and write disk labels without worrying about
  125.  * the format of the machine-specific disk label.  Fields labelled (RO)
  126.  * are read-only.  They should not be modified by a user program.
  127.  * Fields labelled (+) can be modified by user programs, but the results
  128.  * may not be what is desired.  These fields reflect the location and size
  129.  * of other data structures on the disk.  Simply changing them in the
  130.  * label will not suffice.  The data structures will have to be moved also.
  131.  * For some types of machines it is not possible to change these fields
  132.  * because their location is hard-wired into the prom.  Refer to the prom
  133.  * documentation and kernel source code.  The bottom line is you don't
  134.  * want to change the (+) fields unless you really know what you're doing.
  135.  */
  136. typedef struct Disk_Label {
  137.     int    numHeads;        /* Number of heads */
  138.     int    numSectors;        /* Number of sectors per track */
  139.     int numCylinders;        /* Number of cylinders on the disk. */
  140.     int numAltCylinders;    /* Number of alternate cylinders. */
  141.     char asciiLabel[DISK_MAX_ASCII_LABEL];    /* Ascii label. */
  142.     Disk_Partition partitions[DISK_MAX_PARTS]; /* Partition map */
  143.     Disk_NativeLabelType labelType; /* Type of native disk label */
  144.     char *labelPtr;        /* Pointer to native disk label. */
  145.     int    bootSector;        /* (+) Starting sector of boot program */
  146.     int    numBootSectors;     /* (+) Number of boot sectors. */
  147.     int    summarySector;        /* (+) Start of summary information. */
  148.     int    numSummarySectors;     /* (+) Number of sectors in summary info. */
  149.     int domainSector;        /* (+) Sector where domain header starts. */
  150.     int numDomainSectors;    /* (+) Number of sectors in domain header. */
  151.     int numPartitions;        /* (RO) Number of partitions on disk. */
  152.     int asciiLabelLen;        /* (RO) Length of ascii label. */
  153.     int labelSector;        /* (RO) Location of native disk label. */
  154. } Disk_Label;
  155.  
  156. /*
  157.  * Return values for Disk_HasFilesystem.
  158.  */
  159. #define DISK_HAS_NO_FS   0
  160. #define DISK_HAS_OFS     1
  161. #define DISK_HAS_LFS     2
  162.  
  163. /*
  164.  * Forward Declarations.
  165.  */
  166. Disk_Label        *Disk_ReadLabel();
  167. int            Disk_WriteLabel();
  168. int            Disk_EraseLabel();
  169. Disk_Label        *Disk_NewLabel();
  170. Dec_DiskLabel        *Disk_ReadDecLabel();
  171. Sun_DiskLabel        *Disk_ReadSunLabel();
  172. Fsdm_DiskHeader        *Disk_ReadDiskHeader();
  173. Ofs_SummaryInfo        *Disk_ReadSummaryInfo();
  174. int            Disk_WriteSummaryInfo();
  175. Ofs_DomainHeader    *Disk_ReadDomainHeader();
  176. int            Disk_WriteDomainHeader();
  177. void            Disk_PrintDomainHeader();
  178. void            Disk_PrintSummaryInfo();
  179. int            Disk_BlockWrite();
  180. int            Disk_SectorWrite();
  181. int            Disk_BlockRead();
  182. int            Disk_SectorRead();
  183. int            Disk_BadBlockRead();
  184. void            Disk_PrintLabel();
  185. char            *Disk_GetLabelTypeName();
  186. void            Disk_PrintFileDescBitmap();
  187. void            Disk_PrintDataBlockBitmap();
  188. void            Disk_PrintDirEntry();
  189.  
  190.  
  191. int                     Disk_HasFilesystem();
  192. LfsSuperBlock*          Disk_ReadLfsSuperBlock();
  193. ReturnStatus            Disk_WriteLfsSuperBlock();
  194. LfsCheckPointHdr*       Disk_ReadLfsCheckPointHdr();
  195. ReturnStatus            Disk_WriteLfsCheckPointHdr();
  196. ReturnStatus            Disk_WriteLfsCheckPointArea();
  197. LfsCheckPointTrailer*   Disk_LfsCheckPointTrailer();
  198. ReturnStatus            Disk_ForEachCheckPointRegion();
  199. void                    Disk_PrintLfsSuperBlockHdr();
  200. void                    Disk_PrintLfsStableMemParams();
  201. void                    Disk_PrintLfsDescMapParams();
  202. void                    Disk_PrintLfsSegUsageParams();
  203. void                    Disk_PrintLfsFileLayoutParams();
  204. void                    Disk_PrintLfsSuperBlock();
  205. void                    Disk_PrintLfsCheckPointHdr();
  206. void                    Disk_PrintLfsCheckPointRegion();
  207. void                    Disk_PrintLfsCheckPointTrailer();
  208.  
  209. #endif DISK
  210.  
  211.  
  212. @
  213.  
  214.  
  215. 1.3
  216. log
  217. @Changes to reflect the old Sprite file system name being OFS and the
  218. addition of LFS.
  219. @
  220. text
  221. @d16 1
  222. a16 1
  223.  * $Header: /sprite/src/lib/c/disk/RCS/disk.h,v 1.2 90/06/26 21:29:08 jhh Exp $ SPRITE (Berkeley)
  224. d22 2
  225. d31 11
  226. d118 7
  227. d151 19
  228. d171 2
  229. @
  230.  
  231.  
  232. 1.2
  233. log
  234. @updated to new disk library
  235. @
  236. text
  237. @d4 1
  238. a4 1
  239.  *    Definitions for utilities that examine a filesystem through
  240. d16 1
  241. a16 1
  242.  * $Header: /sprite/src/lib/c/disk/RCS/disk.h,v 1.1 90/03/04 22:27:24 douglis Exp Locker: douglis $ SPRITE (Berkeley)
  243. d22 5
  244. a26 4
  245. #include "kernel/fs.h"
  246. #include "kernel/dev.h"
  247. #include "kernel/fsdm.h"
  248. #include "kernel/devDiskLabel.h"
  249. d114 1
  250. a114 1
  251. Fsdm_SummaryInfo    *Disk_ReadSummaryInfo();
  252. d116 1
  253. a116 1
  254. Fsdm_DomainHeader    *Disk_ReadDomainHeader();
  255. @
  256.  
  257.  
  258. 1.1
  259. log
  260. @Initial revision
  261. @
  262. text
  263. @d16 1
  264. a16 1
  265.  * $Header: /sprite/lib/forms/RCS/proto.h,v 1.5 90/01/12 12:03:25 douglis Exp $ SPRITE (Berkeley)
  266. d25 1
  267. a25 1
  268. #include "devDiskLabel.h"
  269. d115 2
  270. d126 3
  271. @
  272.